﻿Public Class DegreesUristArgHandler
    Inherits IntegerArgHandler
    Implements IArgHandler

    Public Overrides Function ValidateArgument(library As RawLibrary, obj As RawObject, argument As ArgumentDefinition, value As String) As String
        Dim parentError As String = MyBase.ValidateArgument(library, obj, argument, value)
        If parentError Is Nothing Then
            If CInt(value) > 60000 Then
                Return "temperature can not be greater that 60000"
            End If

            Return Nothing
        Else
            Return parentError
        End If
    End Function

    Public Overrides Function ValidateTypeData(typeData As String) As Boolean
        If MyBase.ValidateTypeData(typeData) Then
            Dim parts() As String = typeData.Split(" "c)
            If parts.Count > 1 Then
                Dim max As Integer = CInt(parts(1)) 'base class already makes sure that this is an integer
                If max > 60000 Then
                    Return False
                End If
            End If
            Return True
        Else
            Return False
        End If
    End Function
End Class
